package com.gulimall.search.controller;

import com.gulimall.search.service.MallSearchService;
import com.gulimall.search.vo.SearchParam;
import com.gulimall.search.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author kkk
 * @date 2022/7/24
 */
@Controller
public class SearchController {
    @Autowired
    private MallSearchService searchService;

    @GetMapping("/list.html")
    public String listPage(SearchParam searchParam, Model model) {
        SearchResult result = searchService.search(searchParam);

        model.addAttribute("result", result);
        return "list";
    }
}
